
<template>
  <el-dialog :visible.sync="visible" v-dialogDrag :title="title" :close-on-click-modal="false" class="tl-dialog" width="1200px" @open="open" @close="close">
    <el-form class="tl-form" ref="form" :model="model" :rules="rules" label-width="150px" :disabled="disableEditSubmit">
      <el-row>
        <el-col :span="12">
          <el-form-item label="运营部门" prop="deptarchcode" :rules="rules.validateRequire">
            <el-input v-model="model.deptarchname" :disabled="true" class="tl-ref-selector">
              <el-button slot="append" type="primary" icon="el-icon-search" @click="openmisDeptArchRefDialog" v-if="!disableEditSubmit"></el-button>
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="法人部门" prop="deptcode" :rules="rules.validateRequire">
            <tl-ref-dept v-model="model.deptcode" :initDisplayData.sync="model.dispdeptcode" dataType="code" nameType="fullname" :singleSelect="true"></tl-ref-dept>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="生效时间" prop="starteffectivedate">
            <el-date-picker v-model="model.starteffectivedate" type="date" placeholder="生效时间" value-format="yyyy-MM-dd"></el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="失效时间" prop="endeffectivedate">
            <el-date-picker v-model="model.endeffectivedate" type="date" placeholder="失效时间" value-format="yyyy-MM-dd"></el-date-picker>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-form-item label="备注" prop="description">
            <el-input v-model="model.description" type="textarea" :rows="4"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="排序码" prop="sortcode">
            <el-input-number v-model="model.sortcode" controls-position="right" :step="1" :min="0" style="width:100%"></el-input-number>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="有效" prop="enabled">
            <el-radio-group v-model="model.enabled">
              <el-radio :label="parseInt(item.code)" v-for="item in codeModel.enabledList" :key="item.code">{{ item.name }}</el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button :type="disableEditSubmit === false ? 'text' : 'primary'" @click="doCancelEdit">取消</el-button>
      <el-button type="primary" @click="doSubmitEdit" :loading="saveLoading" v-if="disableEditSubmit === false">确认</el-button>
    </div>
    <tl-mis-dept-arch-ref ref="misDeptArchRef" @confirm="getmisDeptArchRefData" :isSingleSelect="true">
    </tl-mis-dept-arch-ref>
  </el-dialog>
</template>

<script>
/** mixins */
import { mixin_edit } from '@tapui/mixins/mixin_edit'
import tlMisDeptArchRef from './../misDeptArch/refList'
/** 工具类 */
import { putAction, getAction, postAction, deleteAction } from '@tapui/utils/http'
/** VUE配置 */
export default {
  mixins: [mixin_edit],
  components: { tlMisDeptArchRef },
  data() {
    return {
      moduleTitle: '运营部门关联表',
      urlPrefix: '/mis/deptArchRelated/',
      url: {
        // 额外的url
      }
    }
  },
  methods: {
    loaded() {
      // 页面加载完毕执行
    },
    /** 打开运营部门参照 */
    openmisDeptArchRefDialog() {
      this.$refs.misDeptArchRef.visible = true
    },
    /** 获取运营部门参数数据 */
    getmisDeptArchRefData(selectionRow, selectKey, selectionValue) {
      this.$set(this.model, 'deptarchcode', selectionRow.code)
      this.$set(this.model, 'deptarchname', selectionRow.name)
    }
  }
}
</script>

